
<template>
<div>
    <div class="mui-numbox" data-numbox-min='1' data-numbox-max="9">
        <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
        <input id="test" class="mui-input-numbox" type="number" value="1"  @change="postNumber" ref="numberBox"/>
        <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
    </div>
</div>
</template>    
<script>
import mui from "../../lib/js/mui.min.js"
export default{
    data(){
        return {
            number:1 
        }
    },
    mounted(){
        // 初始化数字选择框
        mui(".mui-numbox").numbox()
    },
    methods:{
        postNumber(){
            // 每当文本数据 被修改的时候 立即把数据发送给父组件
            this.$emit('getNumber',parseInt(this.$refs.numberBox.value));
        }
    },
}
</script>
<style lang="less" scoped>

</style> 